package model.information;

import java.io.Serializable;
import java.util.Observable;

/**
 * A class that represents a phone number for a contact.
 * @author Tobias Møller Kjærsgaard
 * @author Hjalte Blichfeldt Flyger
 * @author Gitte Simonsen
 * @author Claus Lund
 */
public class ContactPhoneNumber extends Observable implements Serializable {
    private PhoneType type;
    private String countryCode;
    private String number;

    /**
     * Enumeration used for setting the phonenumber type.
     */
    public enum PhoneType {
        MOBILE("Mobiltelefon"),
        HOME("Hjemmenummer"),
        WORK("Arbejde"),
        FAXHOME("Fax Hjemme"),
        FAXWORK("Fax Arbejde");

        String label;

        private PhoneType(String label) {
            this.label = label;
        }

        @Override
        public String toString() {
            return label;
        }
    }

    /**
     * Constructor that takes three arguments.
     * @param type the type of phone number.
     * @param countryCode the country code.
     * @param number the phone number.
     */
    public ContactPhoneNumber(PhoneType type, String countryCode, String number) {
        this.type = type;
        this.countryCode = countryCode;
        this.number = number;
    }

    public String getCountryCode() {
        return countryCode;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public PhoneType getType() {
        return type;
    }

    public void setType(PhoneType type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return countryCode + " " + number + " (" + type.label + ")";
    }

}